<?php	
header('Content-type:text/html;charset=utf8');
date_default_timezone_set("PRC");
//载入smarty
include "../../smarty/Smarty.class.php";
//载入模型类
include "../../model.class.php";
//实例化smarty
$smarty = new Smarty();
//设置模板模板目录
$smarty->template_dir = "View";
//编译目录
$smarty->compile_dir = "temp/compile";
//缓存目录
$smarty->cache_dir = "temp/cache";
//开启缓存
$smarty->caching = true;
//缓存时间
$smarty->cache_lifetime = 13;
//开始定界符
$smarty->left_delimiter = "{";
//结束定界符
$smarty->right_delimiter = "}";

$smarty->assign("time",time());
//局部不缓存
$smarty->register_block("nocache", "nocache",false);
function nocache($params,$content,&$smarty)
{
	return $content;
}

//如果缓存失效，则重新从数据库获取数据
if(!$smarty->is_cached("index.html"))
{
	echo "mysql run";
	$model = new Model();
	$data = $model->query("select * from arcticle");
	$smarty->assign("data",$data);
}
//测试自定义变量调节器
$str = "后盾网";
$smarty->assign("str",$str);


$smarty->display("index.html");

















